<div class="full-screen">
    <div class="page-group">
        <div class="page page-current nocoupon_contentBOX">
            <div class="content">

                <div class="coupon_page_top">
                    <a href="javascript:history.back();"><{img class="coupon_top_return" src="images/icon04.png" app="wap"}></a>
                    <div class="coupon_top_text">申请退款</div>
                </div>

                <form action="<{link app=b2c ctl=wap_member act=to_refund}>" method="post" data-type="ajax" id="to_refund">
                    <input type="hidden" name="order_id" value="<{$order.order_id}>">
                    <input type="hidden" name="apply_id" value="<{$apply_id}>">
                    <div class="arrival_inform_solid"></div>
                    <div class="arrival_inform_content">


                        <div class="arrival_inform_solid"></div>
                        <div class="arrival_inform_list">
                            <span class="arrival_inform_a">订单号:</span>
                                <span class="receiver_inform_b"><{$order.order_id}></span>
                            <div class="clearfix"></div>
                        </div>
                        <div class="arrival_inform_solid"></div>

                        <div class="arrival_inform_list">
                            <span class="arrival_inform_a">金额:</span>
                            <span class="receiver_inform_b"><{$order.payed|cur_odr}></span>
                            <div class="clearfix"></div>
                        </div>
                        <div class="arrival_inform_solid"></div>

                        <div class="arrival_inform_list">
                            <span class="arrival_inform_a">下单时间:</span>
                            <span class="receiver_inform_b"> <{$order.createtime|cdate:FDATE_STIME}></span>
                            <div class="clearfix"></div>
                        </div>
                        <div class="arrival_inform_solid"></div>

                        <div class="arrival_inform_list">
                            <span class="arrival_inform_a">订单状态:</span>
                            <span class="receiver_inform_b">
                                <!-- 添加取消发货状态 -->
                              <{switch from=$order.status}>
                              <{case value='finish'}><{t}>已完成<{/t}>
                              <{case value='dead'}><{t}>已作废<{/t}>
                              <{case}>
                              <{switch from=$order.pay_status}>
                              <{case value='1'}><{t}>已付款<{/t}>
                              <{switch from=$order.ship_status}>
                              <{case value='1'}><{t}>[已发货]<{/t}>
                              <{case value='2'}><{t}>[部分发货]<{/t}>
                              <{case value='3'}><{t}>[部分退货]<{/t}>
                              <{case value='4'}><{t}>[已退货]<{/t}>
                              <{case value='5'}><{t}>[取消发货]<{/t}>
                              <{case}><{t}>[正在备货]<{/t}>
                              <{/switch}>
                              <{case value='2'}><{t}>已付款至担保方<{/t}>
                              <{case value='3'}>
                                                <!--普通订单-->
                              <{if $order.promotion_type != 'prepare'}>
                                <a href="#"><{t}>等待补款<{/t}></a>
                              <{/if}>
                                                <!--预售订单-->
                              <{if  $order.promotion_type == 'prepare'}>
                              <a href="#"><{t}>等待补款<{/t}></a>
                              <{/if}>
                              <{switch from=$order.ship_status}>
                              <{case value='1'}><{t}>[已发货]<{/t}>
                              <{case value='2'}><{t}>[部分发货]<{/t}>
                              <{case value='3'}><{t}>[部分退货]<{/t}>
                              <{case value='4'}><{t}>[已退货]<{/t}>
                              <{case value='5'}><{t}>[取消发货]<{/t}>
                              <{/switch}>
                              <{case value='4'}><{t}>部分退款<{/t}>
                              <{switch from=$order.ship_status}>
                              <{case value='0'}><{t}>[未发货]<{/t}>
                              <{case value='1'}><{t}>[已发货]<{/t}>
                              <{case value='2'}><{t}>[部分发货]<{/t}>
                              <{case value='3'}><{t}>[部分退货]<{/t}>
                              <{case value='4'}><{t}>[已退货]<{/t}>
                              <{case value='5'}><{t}>[取消发货]<{/t}>
                              <{/switch}>
                              <{case value='5'}><{t}>已退款<{/t}>
                              <{switch from=$order.ship_status}>
                              <{case value='0'}><{t}>[未发货]<{/t}>
                              <{case value='1'}><{t}>[已发货]<{/t}>
                              <{case value='2'}><{t}>[部分发货]<{/t}>
                              <{case value='3'}><{t}>[部分退货]<{/t}>
                              <{case value='4'}><{t}>[已退货]<{/t}>
                              <{case value='5'}><{t}>[取消发货]<{/t}>
                              <{/switch}>
                              <{case}>
                                                <!--普通订单-->
                              <{if $order.promotion_type != 'prepare'}>
                                <{if $order.payinfo.pay_app_id != '-1'}><a href="#"><{/if}><{t}>等待付款<{/t}><{if $order.payinfo.pay_app_id != '-1'}></a><{/if}>
                              <{/if}>
                                                <!--预售订单-->
                               <{if $order.promotion_type == 'prepare'}>
                                <{if $order.payinfo.pay_app_id != '-1'}><a href="#"><{/if}><{t}>等待付款<{/t}><{if $order.payinfo.pay_app_id != '-1'}></a><{/if}>
                              <{/if}>
                              <{switch from=$order.ship_status}>
                              <{case value='1'}><{t}>[已发货]<{/t}>
                              <{case value='2'}><{t}>[部分发货]<{/t}>
                              <{case value='3'}><{t}>[部分退货]<{/t}>
                              <{case value='4'}><{t}>[已退货]<{/t}>
                              <{/switch}>
                              <{/switch}>
                              <{/switch}>
                            </span>
                            <div class="clearfix"></div>
                        </div>
                        <div class="arrival_inform_solid"></div>

                        <div class="arrival_inform_list">
                            <span class="arrival_inform_a">支付方式:</span>
                            <span class="receiver_inform_b"><{$order.payinfo.pay_app_id|pay_name}></span>
                            <div class="clearfix"></div>
                        </div>
                        <div class="arrival_inform_solid"></div>

                        <div class="arrival_inform_list">
                            <span class="arrival_inform_a"><em class="f-red">*</em>退款金额:</span>
                            <span class="receiver_inform_b">
                                <input type="receiver_input" name="apply_money" onkeyup="value=value.replace(/[^\d.]/g,'')" placeholder="退款金额请和客服沟通" required="required" data-caution="请填写退款金额">
                            </span>
                            <div class="clearfix"></div>
                        </div>
                        <div class="arrival_inform_solid"></div>
                        <div class="arrival_inform_list">
                            <span class="arrival_inform_a" style="line-height: 6.9rem;"><em class="f-red">*</em>退款理由:</span>
                                <span class="receiver_inform_b">
                                    <textarea type="text" name="content" class="refund_input" placeholder="描述退款理由" required="required" vtype="required" data-caution="请填写退款理由" ></textarea>
                                </span>
                            <div class="clearfix"></div>
                        </div>
                        <div class="arrival_inform_solid"></div>
                        <div class="arrival_inform_list">
                            <a href="javascript:void(0);" class="button button-fill button-success popup_button_color" style="width: 90%;margin-left: 5%;line-height: 1.8rem;height: 1.8rem;" id="go-refund">提交</a>
                            <div class="clearfix"></div>
                        </div>

                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
    $('input[name=apply_money],textarea[name=content]').blur(function(){
        if(!$(this).val()){
            $(this).css('border','1px solid red');
        }else{
            $(this).css('border','1px solid #dcdddd');
        }
    });
    $('#go-refund').on('click',function(e){
        if(!$('input[name=apply_money]').val()){
            alert('请输入退款金额');
            $('input[name=apply_money]').focus();
            return false;
        }

        if(!$('textarea[name=content]').val()){
            alert('请输入退款理由');
            $('textarea[name=content]').focus();
            return false;
        }
        var data = $('#to_refund').serialize();
        $.ajax({
            type:'post',
            url:'<{link app=b2c ctl=wap_member act=to_refund}>',
            data:data,
            success:function(re){
                result = $.parseJSON(re);
                if(result.error){
                    alert(result.error);
                }else{
                    alert(result.success);
                    window.location=result.redirect;
                }
            }
        });
    });
</script>